home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / DYN401.ZIP / class / dict.c < prev    next >
C/C++ Source or Header  |  1997-04-16  |  3KB  |  148 lines

  1.  
  2.  
  3. /*  Copyright (c) 1993-1996 Algorithms Corporation  */
  4. /*  All rights reserved.  */
  5.  
  6.  
  7.  
  8.  
  9. /*  This file automatically generated by dpp - do not edit  */
  10.  
  11. #define    DPP_STRATEGY    2
  12. #define    DPP_FASTWIDE    0
  13.  
  14.  
  15.  
  16.  
  17. #define    CLASS    Dictionary_c
  18. #define    ivType    Dictionary_iv_t
  19.  
  20. #include "generics.h"
  21.  
  22. object    Dictionary_c;
  23.  
  24.  
  25. #line 24 "dict.d"
  26. #include "set1.h" 
  27.  
  28.  
  29. #define LTYPE 1 
  30.  
  31. static gLookup_t Lookup; 
  32.  
  33. imeth objrtn Dictionary_im_gAddValue(object self, object key, object value)
  34.     ChkArg(key, 2); 
  35.     ChkArgNul(value, 3); 
  36.     return Lookup(self, key, HT_ADD, 0, LTYPE, value); 
  37.  
  38. imeth objrtn Dictionary_im_gFindValue(object self, object key)
  39.     object x; 
  40.  
  41.     ChkArg(key, 2); 
  42.     x = Lookup(self, key, HT_FIND, 0, LTYPE, NULL); 
  43.     return x ? gValue(x) : x; 
  44.  
  45. imeth objrtn Dictionary_im_gFind(object self, object key)
  46.     ChkArg(key, 2); 
  47.     return Lookup(self, key, HT_FIND, 0, LTYPE, NULL); 
  48.  
  49. imeth objrtn Dictionary_im_gChangeValueWithObj(object self, object key, object val)
  50.     object x; 
  51.     ChkArg(key, 2); 
  52.     ChkArgNul(val, 3); 
  53.     x = Lookup(self, key, HT_FIND, 0, LTYPE, NULL); 
  54.     return x ? gChangeValue(x, val) : x; 
  55.  
  56. imeth objrtn Dictionary_im_gFindAddValue(object self, object key, object value)
  57.     ChkArg(key, 2); 
  58.     ChkArgNul(value, 3); 
  59.     return Lookup(self, key, HT_FINDADD, 0, LTYPE, value); 
  60.  
  61. imeth objrtn Dictionary_im_gDispose(object self)
  62.     return gDispose1(self); 
  63.  
  64. imeth objrtn Dictionary_im_gDisposeAllNodes(object self)
  65.     return gDisposeAllNodes1(self); 
  66.  
  67. imeth objrtn Dictionary_im_gRemoveObj(object self, object key)
  68.     ChkArg(key, 2); 
  69.     return Lookup(self, key, HT_DELETE, 1, LTYPE, NULL); 
  70.  
  71. imeth objrtn Dictionary_im_gDeepDisposeObj(object self, object key)
  72.     ChkArg(key, 2); 
  73.     return Lookup(self, key, HT_DELETE, 2, LTYPE, NULL); 
  74.  
  75. static void init_class(void) 
  76.     Lookup = imcPointer(Set, gLookup); 
  77.  
  78. #line 99 "dict.c"
  79.  
  80. objrtn    Dictionary_initialize(void)
  81. {
  82.     static  CRITICALSECTION  cs;
  83.     static  int volatile once = 0;
  84.  
  85.     ENTERCRITICALSECTION(_CI_CS_);
  86.     if (!once) {
  87.         INITIALIZECRITICALSECTION(cs);
  88.         once = 1;
  89.     }
  90.     LEAVECRITICALSECTION(_CI_CS_);
  91.  
  92.     ENTERCRITICALSECTION(cs);
  93.  
  94.     if (Dictionary_c) {
  95.         LEAVECRITICALSECTION(cs);
  96.         return Dictionary_c;
  97.     }
  98.     INHIBIT_THREADER;
  99.     Set_initialize();
  100.     if (Dictionary_c)  {
  101.         ENABLE_THREADER;
  102.         LEAVECRITICALSECTION(cs);
  103.         return Dictionary_c;
  104.     }
  105.     Dictionary_c = gNewClass(Class, "Dictionary", 0, 0, Set, END);
  106.     iMethodFor(Dictionary, gDeepDisposeObj, Dictionary_im_gDeepDisposeObj);
  107.     iMethodFor(Dictionary, gChangeValueWithObj, Dictionary_im_gChangeValueWithObj);
  108.     iMethodFor(Dictionary, gFind, Dictionary_im_gFind);
  109.     iMethodFor(Dictionary, gDisposeObj, Dictionary_im_gDeepDisposeObj);
  110.     iMethodFor(Dictionary, gDisposeAllNodes, Dictionary_im_gDisposeAllNodes);
  111.     iMethodFor(Dictionary, gRemoveObj, Dictionary_im_gRemoveObj);
  112.     iMethodFor(Dictionary, gDispose, Dictionary_im_gDispose);
  113.     iMethodFor(Dictionary, gFindAddValue, Dictionary_im_gFindAddValue);
  114.     iMethodFor(Dictionary, gAddValue, Dictionary_im_gAddValue);
  115.     iMethodFor(Dictionary, gFindValue, Dictionary_im_gFindValue);
  116.  
  117.     init_class();
  118.  
  119.     ENABLE_THREADER;
  120.  
  121.     LEAVECRITICALSECTION(cs);
  122.  
  123.     return Dictionary_c;
  124. }
  125.  
  126.  
  127.  
  128.